<div class="row"> <h3 class="page-header">教学实验计划概要表</h3></div>
<div class="row">
    <div class="panel panel-default">
        <div class="panel-body">
         <label><a class="btn btn-primary addText"  data-id='{$list.id}'>添加</a></label>
          <form action='{:U("Jxsygl/jxsyjhgy")}' class="form-inline text-right fr m-b-5">
                实验课程：<select class="form-control mr20 w150" name="course_id">
                            <option value='-1'>全部</option>
                            <volist name='list_course' id='group'>
                                <option value='{$group.id}' <eq name='Think.get.course_id' value="$group.id">selected</eq>>{$group.name}</option>
                            </volist>
                        </select>
                <button class="btn btn-primary" type="submit">搜索</button>
            </form>
            <div class="table-responsive">
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        <th width="60">序号</th>
                        <th>实验周</th>
                        <th>实验课程</th>
                        <th>实验项目</th>
                        <th>填写教师</th>
                        <th>填写时间</th>
                        <th width="120">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                        <empty name="list">
                            <tr><td colspan="7" align="center">暂无信息</td></tr>
                        </empty>
                        <volist name="list" id="list">
                            <tr>
                                <td>{$i}</td>
                                <td>{$list.week}</td>
                                <td>{$list.course}</td>
                                <td>{$list.sxxm}</td>
                                <td>{$list.teacher}</td>
                                <td>{$list.time|date="Y-m-d",###}</td>
                                <td>
                                <a class=" btn btn-default btn-sm editText" data-id='{$list.id}'>修改</a>
                                <button data-url='{:U("Jxsygl/jxsyjhgydel?id=".$list["id"])}' class="btn-sm btn btn-default delBtn" type="button">删除</button>
                                </td>                         
                             </tr>
                         </volist>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<div id="myModal" class="modal fade in" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <form action="{:U('Jxsygl/jxsyjhgyadd')}" id="myform" class="form-horizontal" data-callback="_form_defult_callback">
                <div class="modal-header">
                    <button data-dismiss="modal" class="close" type="button">×</button>
                    <h4 class="modal-title">教学实验计划概要表</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">实验周：</label>
                        <div class="col-sm-4 input-group">
                           <select class="form-control" name="week">
                                <option value="第一周">第一周</option>
                                <option value="第二周">第二周</option>
                                <option value="第三周">第三周</option>
                                <option value="第四周">第四周</option>
                                <option value="第五周">第五周</option>
                                <option value="第六周">第六周</option>
                                <option value="第七周">第七周</option>
                                <option value="第八周">第八周</option>
                                <option value="第九周">第九周</option>
                                <option value="第十周">第十周</option>
                                <option value="第十一周">第十一周</option>
                                <option value="第十二周">第十二周</option>
                                <option value="第十三周">第十三周</option>
                                <option value="第十四周">第十四周</option>
                                <option value="第十五周">第十五周</option>
                                <option value="第十六周">第十六周</option>
                                <option value="第十七周">第十七周</option>
                                <option value="第十八周">第十八周</option>
                                <option value="第十九周">第十九周</option>
                                <option value="第二十周">第二十周</option>
                        </select>
                        </div>
                    </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">实验课程：</label>
                    <div class="col-sm-4 input-group">
                        <select class="form-control" name="course_id">
                            <volist name='list_course' id='group'>
                                <option value="{$group.id}">{$group.name}</option>
                            </volist>
                        </select>
                    </div>
                </div>
                 <div class="form-group">
                    <label class="col-sm-3 control-label">实验项目：</label>
                    <div class="col-sm-4 input-group">
                        <select class="form-control" name="syxm_id">
                            <volist name='list_sxxm' id='group_xm'>
                                <option value="{$group_xm.id}">{$group_xm.name}</option>
                            </volist>
                        </select>
                    </div>
                </div>
                 <div class="form-group">
                    <label class="col-sm-3 control-label">实验室：<span class="c-red">*</span></label>
                    <div class="col-sm-4 input-group">
                       <select class="form-control" name="sys_id">
                            <volist name='list_ssxx' id='list_ssxx'>
                                <option value="{$list_ssxx.id}">{$list_ssxx.name}</option>
                            </volist>
                        </select>
                    </div>
                </div>
                  <div class="form-group">
                    <label class="col-sm-3 control-label">人数：<span class="c-red">*</span></label>
                    <div class="col-sm-4 input-group">
                        <input class="form-control digits" name="number">
                    </div>
                </div>
                  <div class="form-group">
                    <label class="col-sm-3 control-label">上传：<span class="c-red">*</span></label>
                    <div class="col-sm-4 input-group">
                           <div class="uploadify-div">
                        <notempty name='info.file'>
                           <li>{$info.file}<input type="hidden" value="{$info.file}" name="file"><span style="color:blue;cursor:pointer;" class="uploadifyDel">删除</span></li>
                       </notempty>
                      </div>
                       <button class="upload" data-type="file" type="button" name="file" id="upload">添加附件</button>
                    </div>
                </div>
                  <div class="form-group">
                    <label class="col-sm-3 control-label">填写教师：<span class="c-red">*</span></label>
                    <div class="col-sm-4 input-group">
                        <input class="form-control" name="teacher">
                    </div>
                </div>
                  <div class="form-group">
                    <label class="col-sm-3 control-label">填写时间：<span class="c-red">*</span></label>
                    <div class="col-sm-4 input-group">
                      <input class="form-control datepick required" name="time" value=" {:date('Y-m-d H:i')}" readonly="readonly">
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" type="submit">保存</button>
                    <button data-dismiss="modal" class=" btn btn-default" type="button">关闭</button>
                </div>
               <input type='hidden' name='id' value='{$info.id}'>
            </form>
        </div>
    </div>
</div>
<script>
    $(function(){
        $('.addText').click(function(){
            $('#myform')[0].reset();
            $('#myModal').modal('show');
        });
        $('.editText').click(function(){
            $('#myform')[0].reset();
            var id = $(this).data('id'); waiting();
            $.get('{:U("Jxsygl/jxsyjhgyedit")}', {id: id}, function(data){
                complete();
                if(data.status == 1){
                    var _get_info = data.info;
                    $('#myform input[name="id"]').val(_get_info.id);
                    $('#myform select[name="sys"]').val(_get_info.sys);
                    $('#myform input[name="number"]').val(_get_info.number);
                    $('#myform select[name="week"]').val(_get_info.week);
                    $('#myform select[name="course"]').val(_get_info.course);
                    $('#myform select[name="syxm"]').val(_get_info.syxm);
                    $('#myform input[name="teacher"]').val(_get_info.teacher);
                    var div = $('.uploadify-div');
                    if(_get_info.file.length > 0){
                        //有图片
                        var html = '<li>';
                        html += "<a href='"+_get_info.file+"'>附件查看</a>";
                        html += "<input type='hidden' name='file' value='"+_get_info.file+"' /><span style='color:blue;cursor:pointer;' class='uploadifyDel'>删除</span></li>";
                        div.html(html);
                    }else{
                        div.html("");
                    }
                    $('#myform').attr('action', '{:U("Jxsygl/jxsyjhgyedit")}');
                    $('#myModal').modal('show');
                }else{
                    showInfo(data.info);
                    setTimeout('_form_defult_callback()', 1600);

                }
            });
        })
    });

</script>